<template>
	<!-- 首页轮播 -->
	<u-swiper :list="imgList" @click="onClick"></u-swiper>	
</template>

<script>
export default {
	name: 'homeSwipe',
	props: {
		carouselItems: Array
	},	
	computed:{
		imgList(){
			return this.carouselItems.map(item => this.$fullUrl(item.img));
		},
		productIdList(){
			return this.carouselItems.map(item=>item.product_id);
		},
	},
	methods: {
		onClick(index){
			let productId = this.productIdList[index];
			uni.navigateTo({
				url:`/pages/product/ProductDetail?productId=${productId}`
			})
		},		
	}
};
</script>

<style lang="scss" scoped>
</style>
